home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / waves-anim.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  3.5 KB  |  111 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; This program is free software: you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 3 of the License, or
  7. ; (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. ;
  17. ;
  18. ; waves-anim.scm   version 1.01   1997/12/13
  19. ;
  20. ; CHANGE-LOG:
  21. ; 1.00 - initial release
  22. ; 1.01 - some code cleanup, no real changes
  23. ;
  24. ; Copyright (C) 1997 Sven Neumann <sven@gimp.org>
  25. ;
  26. ;
  27. ; Makes a copy of your image and creates an animation of the active layer
  28. ; as if a stone was thrown into the image. The animation may be saved with
  29. ; the gif-plug-in.
  30.  
  31. (define (script-fu-waves-anim img
  32.                               drawable
  33.                               amplitude
  34.                               wavelength
  35.                               num-frames
  36.                               invert)
  37.   (let* ((amplitude (max 0 amplitude))
  38.          (wavelength (max 0 wavelength))
  39.          (num-frames (max 1 num-frames))
  40.          (remaining-frames num-frames)
  41.          (phase 0)
  42.          (phaseshift (/ 360 num-frames))
  43.          (image (car (gimp-image-duplicate img)))
  44.          (source-layer (car (gimp-image-get-active-layer image))))
  45.  
  46.   (gimp-image-undo-disable image)
  47.  
  48.   (if (= invert TRUE)
  49.       (set! phaseshift (- 0 phaseshift)))
  50.  
  51.   (while (> remaining-frames 1)
  52.     (let* (
  53.           (waves-layer (car (gimp-layer-copy source-layer TRUE)))
  54.           (layer-name (string-append "Frame "
  55.                                      (number->string
  56.                                        (- (+ num-frames 2)
  57.                                           remaining-frames) 10
  58.                                        )
  59.                                      " (replace)"))
  60.           )
  61.     (gimp-layer-set-lock-alpha waves-layer FALSE)
  62.     (gimp-image-add-layer image waves-layer -1)
  63.     (gimp-drawable-set-name waves-layer layer-name)
  64.  
  65.     (plug-in-waves RUN-NONINTERACTIVE
  66.                    image
  67.                    waves-layer
  68.                    amplitude
  69.                    phase
  70.                    wavelength
  71.                    0
  72.                    FALSE)
  73.  
  74.     (set! remaining-frames (- remaining-frames 1))
  75.     (set! phase (- phase phaseshift))
  76.     )
  77.   )
  78.  
  79.   (gimp-drawable-set-name source-layer "Frame 1")
  80.   (plug-in-waves RUN-NONINTERACTIVE
  81.                  image
  82.                  source-layer
  83.                  amplitude
  84.                  phase
  85.                  wavelength
  86.                  0
  87.                  FALSE)
  88.  
  89.   (gimp-image-undo-enable image)
  90.   (gimp-display-new image)
  91.   )
  92. )
  93.  
  94. (script-fu-register "script-fu-waves-anim"
  95.   _"_Waves..."
  96.   _"Create a multi-layer image with an effect like a stone was thrown into the current image"
  97.   "Sven Neumann <sven@gimp.org>"
  98.   "Sven Neumann"
  99.   "1997/13/12"
  100.   "RGB* GRAY*"
  101.   SF-IMAGE       "Image" 0
  102.   SF-DRAWABLE    "Drawable" 0
  103.   SF-ADJUSTMENT _"Amplitude"        '(10 1   101 1 10 1 0)
  104.   SF-ADJUSTMENT _"Wavelength"       '(10 0.1 100 1 10 1 0)
  105.   SF-ADJUSTMENT _"Number of frames" '(6  1   512 1 10 0 1)
  106.   SF-TOGGLE     _"Invert direction" FALSE
  107. )
  108.  
  109. (script-fu-menu-register "script-fu-waves-anim"
  110.                          "<Image>/Filters/Animation/Animators")
  111.